package com.wang.gallerybackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wang.gallerybackend.model.dto.space.SpaceAddRequest;
import com.wang.gallerybackend.model.dto.space.SpaceQueryRequest;
import com.wang.gallerybackend.model.entity.Space;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wang.gallerybackend.model.entity.User;
import com.wang.gallerybackend.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 汪
 * @description 针对表【user_space(用户空间表)】的数据库操作Service
 * @createDate 2025-08-13 10:38:17
 */
public interface SpaceService extends IService<Space> {
	/**
	 * 校验空间
	 * @param space
	 * @param add 是否为创建
	 */
	void validSpace(Space space, boolean add);

	/**
	 * 获取查询对象
	 *
	 * @param spaceQueryRequest
	 * @return
	 */
	QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);


	Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

	/**
	 * 获取空间封装
	 * @param space
	 * @param request
	 * @return
	 */
	SpaceVO getSpaceVO(Space space, HttpServletRequest request);

	/**
	 * 根据空间等级填充空间信息
	 * @param space
	 */
	void fillSpaceBySpaceLevel(Space space);

	/**
	 * 添加空间
	 * @param spaceAddRequest 添加空间请求
	 * @return 添加的空间ID
	 */
	long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);


	/**
	 *  校验空间权限
	 * @param loginUser
	 * @param space
	 */
	void checkSpaceAuth(User loginUser, Space space);
}
